package com.daoeping.data;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bzn_answer entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "bzn_answer", catalog = "daoeping")
public class Bzn_answer implements java.io.Serializable {

	// Fields

	private Integer id;
	private Usr_user usr_user;
	private Bzn_question bzn_question;
	private String content;
	private String attachment;
	private Timestamp createDatetime;
	private Timestamp updateDatetime;
	private Set<Bzn_answercomm> bzn_answercomms = new HashSet<Bzn_answercomm>(0);

	// Constructors

	/** default constructor */
	public Bzn_answer() {
	}

	/** minimal constructor */
	public Bzn_answer(Usr_user usr_user, Bzn_question bzn_question) {
		this.usr_user = usr_user;
		this.bzn_question = bzn_question;
	}

	/** full constructor */
	public Bzn_answer(Usr_user usr_user, Bzn_question bzn_question,
			String content, String attachment, Timestamp createDatetime,
			Timestamp updateDatetime, Set<Bzn_answercomm> bzn_answercomms) {
		this.usr_user = usr_user;
		this.bzn_question = bzn_question;
		this.content = content;
		this.attachment = attachment;
		this.createDatetime = createDatetime;
		this.updateDatetime = updateDatetime;
		this.bzn_answercomms = bzn_answercomms;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id", nullable = false)
	public Usr_user getUsr_user() {
		return this.usr_user;
	}

	public void setUsr_user(Usr_user usr_user) {
		this.usr_user = usr_user;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "question_id", nullable = false)
	public Bzn_question getBzn_question() {
		return this.bzn_question;
	}

	public void setBzn_question(Bzn_question bzn_question) {
		this.bzn_question = bzn_question;
	}

	@Column(name = "content", length = 2000)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "attachment", length = 2000)
	public String getAttachment() {
		return this.attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	@Column(name = "create_datetime", length = 19)
	public Timestamp getCreateDatetime() {
		return this.createDatetime;
	}

	public void setCreateDatetime(Timestamp createDatetime) {
		this.createDatetime = createDatetime;
	}

	@Column(name = "update_datetime", length = 19)
	public Timestamp getUpdateDatetime() {
		return this.updateDatetime;
	}

	public void setUpdateDatetime(Timestamp updateDatetime) {
		this.updateDatetime = updateDatetime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_answer")
	public Set<Bzn_answercomm> getBzn_answercomms() {
		return this.bzn_answercomms;
	}

	public void setBzn_answercomms(Set<Bzn_answercomm> bzn_answercomms) {
		this.bzn_answercomms = bzn_answercomms;
	}

}